robot myRobot;

void setup(){
  size(1024,600);
  myRobot = new robot(width/2,height-100,100,100);
}

void draw(){
  background(200);
  myRobot.drawRobot();
  
  /*
  if(isPointInCircle(mouseX, mouseY, 200-25, 200-25, 50, 50)){
    fill(100);
  }else{
    fill(200);
  }  
  arc(200, 200, 50, 50,0,TWO_PI);
  */
  PVector temp = myRobot.getAxisTrans(2);
  arc(temp.x, temp.y, 20, 20, 0, TWO_PI);
  if(isPointInCircle(mouseX, mouseY, temp.x-(15*myRobot.scaleValue), temp.y-(15*myRobot.scaleValue), 15*myRobot.scaleValue, 15*myRobot.scaleValue)){
    fill(100);
  }else{
    fill(200);
  }
  
  /*
  if(mousePressed()){
    if(isPointInCircle(mouseX, mouseY, myRobot.AxisX[1], myRobot.AxisY[1], myRobot.AxisWidth[1], myRobot.AxisHeight[1]){ 
     
    }else if(isPointInCircle(mouseX, mouseY, myRobot.AxisX[2], myRobot.AxisY[2], myRobot.AxisWidth[2], myRobot.AxisHeight[2]){ 
     
    }else if(isPointInCircle(mouseX, mouseY, myRobot.AxisX[3], myRobot.AxisY[3], myRobot.AxisWidth[3], myRobot.AxisHeight[3]){ 
     
    } 
  }
  */
}

public boolean isPointInCircle(double x, double y, double circleX, double circleY, double circleWidth, double circleHeight){
  double _x= circleWidth/2.0+circleX;
  double _y= circleHeight/2.0+circleY;
    
  double distance=getDistance(_x, _y, x, y);
 
  return (distance<= circleWidth/2.0); //if the distance from the point to the center of the circle is less than the radius of the circle return true
}
 
float getDistance(double x1, double y1, double x2, double y2){
  return sqrt((float)((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)));
}
